#pragma once

#include <iostream>
#include <string>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

//公共文件名
const char* filename = "./fifo";

//读取数据大小
const int size = 1024;

//公共权限
const mode_t permissions = 0666;

//写
const int o_wronly =  O_WRONLY;

//读
const int o_rdonly = O_RDONLY;

//打开文件
int Open(int flag)
{
    int fd = open(filename,flag);
    if(fd < 0)
    {
        std::cerr<<"打开文件失败"<<std::endl;
    }

    return fd;
}

//关闭文件
void Close(int fd)
{
    if(fd > 0)
        close(fd);
}



